package com.ysh.springbootssm.controller;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ysh.springbootssm.mapper.UserInfoMapper;
import com.ysh.springbootssm.pojo.SysUserInfo;
import netscape.security.UserTarget;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 袁胜虎 on 2022/9/19 20:22
 */
@RestController
@RequestMapping("/user")
public class TestConctroller {
    private UserInfoMapper userInfoMapper;

    @Autowired
    public void setUserInfoMapper(UserInfoMapper userInfoMapper) {
        this.userInfoMapper = userInfoMapper;
    }

    @GetMapping("/user")
    public PageInfo<SysUserInfo> findByPage(int pageNum, int pageSize){
        PageHelper.startPage(pageNum,pageSize);
        List<SysUserInfo> allUser = userInfoMapper.findAllUser();
        return new PageInfo<>(allUser);
    }
}
